import * as types from './types.js'
const actions = {
    login ({commit}, data) {
        commit(types.LOGIN, data);
        commit(types.LOGINSTATUS, true);
        sessionStorage.setItem('token', data);
        
    },
    setUser ({ commit }, data) {
        commit(types.USERINFO, data);
        sessionStorage.setItem('user', JSON.stringify(data));
    },
    logOut ({ commit }) {
        commit(types.USERINFO, null);
        commit(types.LOGINSTATUS, false);
        commit(types.LOGOUT);
        sessionStorage.removeItem('token');
        sessionStorage.removeItem('user');
        sessionStorage.removeItem('currentScheme');
    },
    updateUserData({ commit }, bool) {
        commit(types.UPDATEUSERDATA, bool);
    },
    updateSchemeData({ commit }, bool) {
        commit(types.UPDATESCHEMEDATA, bool);
    },
    updateServiceData({ commit }, bool) {
        commit(types.UPDATESERVICEDATA, bool);
    },
    currentScheme({ commit }, data) {
        commit(types.CURRENTSCHEME, data);
        sessionStorage.setItem('currentScheme', data);
    },
    currentStreamUrl({ commit }, data) {
        commit(types.CURRENTSTREAMURL, data);
        // sessionStorage.setItem('currentStreamUrl', data);
    },
    collapseFlag({ commit }, bool) {
        commit(types.COLLAPSEFLAG, bool);
    },
    isVideoFullScreen({ commit }, bool){
        commit(types.ISVIDEOFULLSCREEN, bool);
    }
      
}
export default actions